package com.docker.apps.afterservice.ui;

import android.arch.lifecycle.ViewModelProviders;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.docker.apps.R;
import com.docker.apps.databinding.ProAfterServiceChooseActivityBinding;
import com.docker.apps.afterservice.vm.AfterServiceViewModel;
import com.docker.common.common.router.AppRouter;
import com.docker.common.common.ui.base.NitCommonActivity;

/**
 * kxf -> 2020-02-18
 **/
@Route(path = AppRouter.ORDER_AFTER_CHOOSE)
public class AfterServiceChooseActivity extends NitCommonActivity<AfterServiceViewModel, ProAfterServiceChooseActivityBinding> {
    String returnId ="";
    @Override
    public void initView() {
        mToolbar.setTitle("退/换货");
        boolean isFirst = getIntent().getBooleanExtra("isFirst", true);

        returnId = getIntent().getStringExtra("returnId");
        mBinding.chooseR1.setOnClickListener(v -> {
            ARouter.getInstance().build(AppRouter.ORDER_AFTER_APPLY)
                    .withString("orderid", getIntent().getStringExtra("orderid"))
                    .withSerializable("goodsInfo", getIntent().getSerializableExtra("goodsInfo"))
                    .withBoolean("isReturn", false)
                    .withString("returnId",returnId)
                    .withBoolean("isFirst", isFirst).navigation();
            this.finish();
        });
        mBinding.chooseR2.setOnClickListener(v -> {
            ARouter.getInstance().build(AppRouter.ORDER_AFTER_APPLY)
                    .withString("orderid", getIntent().getStringExtra("orderid"))
                    .withSerializable("goodsInfo", getIntent().getSerializableExtra("goodsInfo"))
                    .withBoolean("isReturn", true)
                    .withString("returnId",returnId)
                    .withBoolean("isFirst", isFirst).navigation();
            this.finish();
        });
    }

    @Override
    public void initObserver() {


    }

    @Override
    public void initRouter() {
        ARouter.getInstance().inject(this);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.pro_after_service_choose_activity;
    }

    @Override
    public AfterServiceViewModel getmViewModel() {
        return ViewModelProviders.of(this, factory).get(AfterServiceViewModel.class);
    }
}